package org.example;

import java.io.*;

public class IO_Demo15 {
    public static void main(String[] args) throws IOException {
        //IO:随用随建 啥时候不用就关闭
        //读取
        BufferedReader br=new BufferedReader(new FileReader("文件路径"));
        String line=br.readLine();
        br.close();
        int count=Integer.parseInt(line);
        count++;
        if(count<=3){
            System.out.println("你有"+count+"次机会");
        }else{
            System.out.println("你没有机会了");
        }
        //写出
        BufferedWriter bw=new BufferedWriter(new FileWriter("文件路径"));
        bw.write(count+"");//要写出“ ”来变成字符串
        bw.close();
    }
}
